package com.wxg.study.bean;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.stereotype.Component;

import com.wxg.study.bean.base.BaseLoggerBean;

@Component
public class MyBean extends BaseLoggerBean{

	@Value("${name}")
	private String name;
	
	@Value("${my.secret}")
	private String secret;
	
	@Value("${my.number}")
	private int number;
	
	@Value("${my.bignumber}")
	private long bignumber;
	
	@Value("${app.name}")
	private String appName;
	
	@Value("${app.description}")
	private String appDescription;
	
	@Autowired
	public MyBean(ApplicationArguments args) {
		boolean debug = args.containsOption("debug");
		List<String> list = args.getNonOptionArgs();
		logger.info("debug : {}", debug);
		logger.info("list : {}", list);
		
		//这里输出的为 : null, 但是注入到其他的类中调用 getName() 方法是可以拿到值的！
		logger.info("name : {}", name);
	}

	public String getName() {
		return name;
	}

	public String getSecret() {
		return secret;
	}

	public int getNumber() {
		return number;
	}

	public long getBignumber() {
		return bignumber;
	}

	public String getAppName() {
		return appName;
	}

	public String getAppDescription() {
		return appDescription;
	}
	
	
}
